const express = require("express");

const app = express();

app.get("/request", (req, res) => {
  //原生
  // console.log(req.method);
  // console.log(req.url);
  // console.log(req.httpVersion);
  // console.log(req.headers);

  //express操作
  //http://localhost:3001/request?a=100&b=2
  console.log(req.path);
  console.log(req.query);

  //ip
  console.log(req.ip);

  //请求头
  console.log(req.get("host"));

  res.end("hello request");
});

app.listen(3001, () => {
  console.log("服务已经启动,监听3001");
});
